function getGraphicsScore(tipo){
    try{
        //var _loading = document.getElementById(loading);
        //if(_loading) _loading.style.visibility="visible";
        //this.setTimeout(getGraphicsImp(loading), 1000);
        this.setTimeout(getGraphicsImpScore(tipo), 1000);
    }catch(ex){}
}

    function getGraphicsImpScore(tipo){
   
    var path;
    var idScoreCard;
    var startDate;
    var endDate;
    if(tipo=='General'){
        //alert("Entre a General");
        idScoreCard= document.getElementById("idScoreCard").getAttribute("value");
        startDate = document.getElementById("startDate").getAttribute("value");
        endDate = document.getElementById("endDate").getAttribute("value");
        path="ajaxDashboardPointerScore.do?scoreCard="+idScoreCard+"&startDate="+startDate+"&endDate=" + endDate;
        //alert("El path es: " + path);
    }else if(tipo=='Drill'){
        //alert("Entre a Drill");
        var pointer = document.getElementById("pointer").getAttribute("value");
        var dimenCut = document.getElementById("dimensionalCut").getAttribute("value");
        var dimensionMember = document.getElementById("dimensionMember").getAttribute("value");
        startDate = document.getElementById("startDate").getAttribute("value");
        endDate = document.getElementById("endDate").getAttribute("value");
        path="ajaxDrillDashboardScore.do?pointer="+pointer+"&dimensionalCut="+dimenCut+"&dimensionMember="+dimensionMember+"&startDate="+startDate+"&endDate=" + endDate;
    }else if(tipo=='ScoreCard'){
        //alert("Entre a ScoreCard");
        idScoreCard= document.getElementById("idScoreCard").getAttribute("value");
        startDate = document.getElementById("startDate").getAttribute("value");
        endDate = document.getElementById("endDate").getAttribute("value");
        path="ajaxDashboardScoreCardScore.do?scoreCard="+idScoreCard+"&startDate="+startDate+"&endDate=" + endDate;
        //alert("Path: " + path);
    }
    

    var ajax = new accesoAJAX.CargadorDeDatos("POST",path,
        function(data){
            //alert(data);
            document.getElementById("chartdivScore").innerHTML = "";
            var chart;
            var legend;

            var XMLresponse = buildXMLFromString(data);
            var elems = XMLresponse.getElementsByTagName("register");
            var graphics = XMLresponse.getElementsByTagName("graphics");
            var scoresInfo = XMLresponse.getElementsByTagName("scoreInfo");
            if(elems && graphics){

                var datos = new Array();


                for(var i=0;i<elems.length;i++){
                    // alert(elems[i]+","+i);
                    //String that will eval
                    var evalstring = "datos["+i+"] = {";
                    var register = elems[i];


                    var date = register.getAttribute("date");
                    evalstring+="period:'"+date+"'";

                    var datas = register.childNodes;
                    //var real,goal;
                    for(var j=0;j<datas.length;j++){
                        if(datas[j].getAttribute){
                            var score= 0;
                            var type = datas[j].getAttribute("cut");
                            score = datas[j].getAttribute("score");
                            var dataeval = ","+type+":"+score;
                            evalstring += dataeval;

                        }
                    }
                    evalstring+="};"

                    //alert(evalstring);
                    eval(evalstring);
                    console.log(datos[i]);
                }
		
		var scoreInfo = scoresInfo[0];
		var unit = scoreInfo.getAttribute("unit");
		
                chart = new AmCharts.AmSerialChart();
                chart.dataProvider = datos;
                chart.categoryField = "period";
                chart.startDuration = 1;
                chart.marginTop = 25;
                chart.marginLeft = 47;
                chart.rotate = false;

                for(var i=0;i<graphics.length;i++){
                    var register = graphics[i];
                    var dimensionalCut = register.getAttribute("dimensionalCut");
                    var valueFieldGraphic= dimensionalCut;


                       
                    var graph1 = new AmCharts.AmGraph();
                    graph1.title = valueFieldGraphic;
                    graph1.valueField = valueFieldGraphic;
                    graph1.type = "column";
                    graph1.balloonText="[[value]]"+unit;
                    graph1.lineAlpha = 0;
                    graph1.fillAlphas = 1;
                    chart.addGraph(graph1);


                }


                var catAxis = chart.categoryAxis;
                catAxis.gridPosition = "start";
                catAxis.dashLength = 5;

                var valAxis = new AmCharts.ValueAxis();
                valAxis.dashLength = 5;
                chart.addValueAxis(valAxis);

                var valAxis2 = new AmCharts.ValueAxis();
                valAxis2.position = "top";
                chart.addValueAxis(valAxis2);

                var legend = new AmCharts.AmLegend();
                legend.align = "center";
                chart.addLegend(legend);

                chart.write("chartdivScore");
            }
        // document.getElementById(loading).style.visibility="hidden";
        });
}